<?php
/**
 * True Gallery userpanel view template file
 *
 * @version 2.5
 * @author Alexey N. Brin (userxp@joomlaportal.ru)
 * @homepage http://truegallery.ru 
 * @filename userpanel.search.tpl.php
 * @package True Gallery
 * @copyright (C) 2008-2009 by joomlatune.ru
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 * 
 * THIS GALLERY is an EVOLUTION of AkoGallery -> PonyGallery -> DatsoGallery
 *
 * If you fork this to create your own project, 
 * please make a reference to True Gallery someplace in your code 
 * and provide a link to http://www.joomlatune.ru
 *
 **/

defined('_VALID_MOS') or defined('_JEXEC') or die('Direct Access to this location is not allowed.');

//xdump( $rows );
?>
<style>
	div.true_picture {
		width: 50% !important;
		float: left;
	}
	div.picture_thumb {
		/*display: none;*/
		float:left;
		/*width:100px;
		height:100px;
		border:2px solid red;*/
	}
	div.picture_title {
		float:left;
		width:auto;
	}
	div.picture_desc {
		float:left;
	}
	table.thetable {
		width: 100%;
	}
	table.thetable td,
	table.thetable th {
		border: 1px solid whitesmoke;
	}
</style>

<form action="index.php?option=com_true&vaiew=userpanel&task=view" method="post" name="adminForm" >
	
	<!--input type="button" name="Button" value="<?php echo JText::_('TG_NEW_PICTURE'); ?>" onclick="javascript:location.href='<?php echo JRoute::_( $tgurl.'&task=showupload' ); ?>';" class="button" /-->
	<h1><?php echo JText::_('TG_SEARCH_RESULTS'),' : '.$sstring; ?></h1>
	<div align="center">
		<?php //$listnav->nav->writeLimitBox(); ?>
		<?php echo $listnav->html; ?>
		<?php echo $listnav->nav->writeOfCounter(); //$pageNav->writePagesLinks("$tgurl&task=userpannel"); ?>
	</div>
	<?php
	

	if( $ad_approve ) {
		echo '<td>'.JText::_('TG_APPROWED').'</td>';
	}

	$k = 0;
	if( count($rows) ) {
		
		//$lo->view	= 'userpanel';
		$lo->Itemid	= $Itemid;
		$lo->view	= 'pictures';
		$lo->task	= 'view';
		
		?>
		<table class="thetable">
		<tr>
			<th>Image</th>
			<th><?php echo JText::_('TG_PIC_NAME'); ?></th>
			<th>Type</th>
			<th>Category</th>
			<th>Data</th>
			<th><?php echo JText::_('TG_HITS'); ?></th>
			<th><?php echo JText::_('TG_AUTHOR'); ?></th>
			<th>#</th>
		</tr>
		<?php
		
		foreach( $rows as $row ) {

			?>
			<tr>
				<td rowspan="2">
					<div class="picture_thumb">
						<a href="<?php echo getTGLink($lo); ?>" title="<?php echo JText::_('TG_GO_TO_PIC'); ?>">
							<img width="50" height="50" src="<?php echo $pic; ?>" border="0" />
						</a>
					</div>
				</td>
				<td><?php echo $row->imgtitle; ?></td>
				<td><?php echo 'Category/Image'; ?></td>
				<td><?php echo ShowCategoryPath($row->catid); ?></td>
				<td><?php echo date( "d.m.Y", $row->imgdate ); ?></td>
				<td><?php echo $row->imgcounter; ?></td>
				<td><?php echo $row->author; ?></td>
				<td rowspan="2">
			<?php
			$k = 1 - $k;
			$kp = $k + 1;
			
			//$thumbnailpath	= TG_THUMBSWAY.'/'.$row->catid.'/';
			//$imgprev		= $thumbnailpath.$row->imgfilename;
			
			//xdump( $row->id.'-'.$row->catid.'-'.$Itemid.'-' . 2 . '-'.$row->imgfilename );
			
			//xdump( $pic );
			
			
			//$comments = '';
			/*$comments2		= $mainframe->getCfg( 'absolute_path' ) . '/components/com_jcomments/jcomments.php';
			if( file_exists( $comments2 ) ) {
				require_once( $comments2 );
				$comments = JComments::getCommentsCount($row->id, 'com_true');
			} else {
				$comments = JText::_('TG_ALLOW_COMM_NO_JC');
			}*/
			
			//$plugin = 'comments';
			//include( TG_ADMINPATH.'plugins'.DSX.$plugin.DSX.$plugin.'.php' );
			// sefRelToAbs($tgurl.'&task=detail&catid='.$row->catid.'&id='.$row->id.'&Itemid='.$Itemid)
			$lo->catid	= $row->catid;
			$lo->id		= $row->id;
			//$lo->task	= 'detail';
			$pic = buildPictureAjaxLink($row->id,$row->catid,$Itemid,2,$row->imgfilename);
			/*
			?>
			<div class="true_picture">
			<?php ob_start(); ?>
				<div class="picture_thumb">
					<a href="<?php echo getTGLink($lo); ?>" title="<?php echo JText::_('TG_GO_TO_PIC'); ?>">
						<!--img height="95" class="dt2" src="<?php //echo $thumbnailpath.$row->imgfilename; ?>" border="0" /-->
						<img width="60" height="60" src="<?php echo $pic; ?>" border="0" />
					</a>
				</div>
				<div class="picture_title">
					<!--h1--><?php echo JText::_('TG_PIC_NAME'); ?> : <?php echo $row->imgtitle; ?><!--/h1-->
					<!--/div><div class="picture_desc"-->
					<?php echo JText::_('TG_HITS'); ?>: <?php echo $row->imgcounter; ?><!--br/-->
					<?php // echo JText::_('TG_COMMENT'); ?>: <?php //echo $comments; ?>
					<br />
					<!--<?php echo JText::_('TG_CATEGORY'); ?>: <?php //echo ShowCategoryPath($row->catid); ?>--><!--br/-->
					<div class="clr"></div>
					<?php echo Button2( JText::_('TG_PREVIEW').'&nbsp;'.JTuneLayout::getImage('true'),'abutton','page',getTGLink($lo),'left'); ?>
					<!--
					<?php $lo->task	= 'editpic' ?>
					<?php echo Button2( JText::_('TG_EDIT').'&nbsp;'.JTuneLayout::getImage('edit'),'abutton','page',getTGLink($lo),'left'); ?>
					<?php echo Button2( JText::_('TG_DELETE').'&nbsp;'.JTuneLayout::getImage('edit_trash'),'abutton','page',getTGLink($lo),'left'); ?>
					-->
				</div>
				<?php
				$c = ob_get_contents();
				ob_end_clean();
				echo getRoundedTab( $c );
				?>
			</div>
			<?php 
			*/
			
			
			/*
			if( $ad_approve ) { // approve ?????? why?
				if( $row->approved ) {
					$a_pic = "<a onmouseover=\"javascript:return overlib('" . JText::_('TG_PIC_APPROVED') . "');\" onmouseout=\"javascript:return nd();\">";
					$a_pic .= '<img src="'.JTuneLayout::getImageFile('tick').'" border="0" /></a>';
				} else {
					$a_pic = "<a onmouseover=\"javascript:return overlib('" . JText::_('TG_PIC_PENDING') . "');\" onmouseout=\"javascript:return nd();\">";
					$a_pic .= '<img src="'.JTuneLayout::getImageFile('publish_x').'" border="0" /></a>';
				}
				echo $a_pic;
			}
			*/
			?>
				</td>
			</tr>
			<tr>
				<td colspan="6">
					<?php echo 'description'; ?>
				</td>
			</tr>
			<?php
		}
		?></table><?php
	} else {
		?>
		<!--tr class="sectiontableentry<?php echo @$kp; ?>">
			<td width="15" align="center" valign="middle">
				<div align="center"><?php echo JTuneLayout::getImage( 'blank','images','.gif'); ?></div>
			</td>
			<td colspan="5"><?php echo JText::_('TG_NOT_HAVE_PIC'); ?></td>
		</tr-->
		<?php echo JText::_('TG_NOT_HAVE_PIC'); ?>
		<?php
	}
		?><!--tr>
			<td align="right" colspan="5">
			</td>
		</tr>
	</table-->
	<div align="center">
		<?php echo $listnav->html; ?>
		<?php echo $listnav->nav->writeOfCounter(); //$pageNav->writePagesLinks("$tgurl&task=userpannel"); ?><br />
		<?php //$pageNav->writePagesCounter(); ?><br />
		<?php //$pageNav->writeLimitBox("$tgurl&task=userpannel"); ?>
</div>
</form>